namespace Jumpton.SFA.Server.Entity {
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    
    
    [Map("ORDER_HEADERS")]
    public class ORDER_HEADERS : ObjectRow {
        
        public ORDER_HEADERS() {
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public ORDER_HEADERS(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }

        [Key("ID")]
        public String ID
        {
            get
            {
                return (System.String)GetValue("ID");
            }
            set
            {
                SetValue("ID", value);
            }
        }

        [Key("ORDER_NO")]
        public String ORDER_NO
        {
            get
            {
                return (System.String)GetValue("ORDER_NO");
            }
            set
            {
                SetValue("ORDER_NO", value);
            }
        }

        [Field("ORDER_date")]
        public decimal ORDER_date
        {
            get
            {
                return (System.Decimal)GetValue("ORDER_date");
            }
            set
            {
                SetValue("ORDER_date", value);
            }
        }

        [Field("REQ_DELIVERY_date")]
        public decimal REQ_DELIVERY_date
        {
            get
            {
                return (System.Decimal)GetValue("REQ_DELIVERY_date");
            }
            set
            {
                SetValue("REQ_DELIVERY_date", value);
            }
        }

        [Field("CUSTOMER_ID")]
        public decimal CUSTOMER_ID
        {
            get
            {
                return (System.Decimal)GetValue("CUSTOMER_ID");
            }
            set
            {
                SetValue("CUSTOMER_ID", value);
            }
        }

        [Field("TOTAL_AMOUNT")]
        public decimal TOTAL_AMOUNT
        {
            get
            {
                return (System.Decimal)GetValue("TOTAL_AMOUNT");
            }
            set
            {
                SetValue("TOTAL_AMOUNT", value);
            }
        }

        [Field("TOTAL_QUANTITY")]
        public decimal TOTAL_QUANTITY
        {
            get
            {
                return (System.Decimal)GetValue("TOTAL_QUANTITY");
            }
            set
            {
                SetValue("TOTAL_QUANTITY", value);
            }
        }

        [Field("STATUS")]
        public decimal STATUS
        {
            get
            {
                return (System.Decimal)GetValue("STATUS");
            }
            set
            {
                SetValue("STATUS", value);
            }
        }

        [Field("VISIT_ID")]
        public decimal VISIT_ID
        {
            get
            {
                return (System.Decimal)GetValue("VISIT_ID");
            }
            set
            {
                SetValue("VISIT_ID", value);
            }
        }

        [Field("DOMAIN_ID")]
        public string DOMAIN_ID
        {
            get
            {
                return (System.String)GetValue("DOMAIN_ID");
            }
            set
            {
                SetValue("DOMAIN_ID", value);
            }
        }

        [Field("CANCELLED")]
        public string CANCELLED
        {
            get
            {
                return (System.String)GetValue("CANCELLED");
            }
            set
            {
                SetValue("CANCELLED", value);
            }
        }

        [Field("LAST_UPDATER")]
        public string LAST_UPDATER
        {
            get
            {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set
            {
                SetValue("LAST_UPDATER", value);
            }
        }

        [Field("LAST_UPDATE_TIME")]
        public decimal LAST_UPDATE_TIME
        {
            get
            {
                return (long)GetValue("LAST_UPDATE_TIME", DateTime.Now);
            }
            set
            {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }

        [Field("USER_ID")]
        public decimal USER_ID
        {
            get
            {
                return (System.Decimal)GetValue("USER_ID");
            }
            set
            {
                SetValue("USER_ID", value);
            }
        }

        [Field("REQUESTED_DELIVERY_TIME")]
        public DateTime REQUESTED_DELIVERY_TIME
        {
            get
            {
                return (System.DateTime)GetValue("REQUESTED_DELIVERY_TIME");
            }
            set
            {
                SetValue("REQUESTED_DELIVERY_TIME", value);
            }
        }

        [Field("PROMO")]
        public string PROMO
        {
            get
            {
                return (System.String)GetValue("PROMO");
            }
            set
            {
                SetValue("PROMO", value);
            }
        }

        [Field("ORG_ID")]
        public int ORG_ID
        {
            get
            {
                return (System.Int32)GetValue("ORG_ID");
            }
            set
            {
                SetValue("ORG_ID", value);
            }
        }

        [Field("PERSON_ID")]
        public decimal PERSON_ID
        {
            get
            {
                return (System.Decimal)GetValue("PERSON_ID");
            }
            set
            {
                SetValue("PERSON_ID", value);
            }
        }

        [Field("SUPPLY_ID")]
        public decimal SUPPLY_ID
        {
            get
            {
                return (System.Decimal)GetValue("SUPPLY_ID");
            }
            set
            {
                SetValue("SUPPLY_ID", value);
            }
        }

        [Field("OrderType")]
        public int OrderType
        {
            get
            {
                return (System.Int32)GetValue("OrderType");
            }
            set
            {
                SetValue("OrderType", value);
            }
        }

        [Field("CHAIN_ID")]
        public int CHAIN_ID
        {
            get
            {
                return (System.Int32)GetValue("CHAIN_ID");
            }
            set
            {
                SetValue("CHAIN_ID", value);
            }
        }

        [Field("CONFIRMED_DATE")]
        public decimal CONFIRMED_DATE
        {
            get
            {
                return (System.Decimal)GetValue("CONFIRMED_DATE");
            }
            set
            {
                SetValue("CONFIRMED_DATE", value);
            }
        }
         [Field("CONFIRM_USER_CODE")]
        public string CONFIRM_USER_CODE
        {
            get
            {
                return (System.String)GetValue("CONFIRM_USER_CODE");
            }
            set
            {
                SetValue("CONFIRM_USER_CODE", value);
            }
        }
        
        [Field("ARRIVAL_DATE")]
         public decimal ARRIVAL_DATE
        {
            get
            {
                return (System.Decimal)GetValue("ARRIVAL_DATE");
            }
            set
            {
                SetValue("ARRIVAL_DATE", value);
            }
        }

        [Field("ORDER_FORM")]
        public decimal ORDER_FORM
        {
            get
            {
                return (System.Decimal)GetValue("ORDER_FORM");
            }
            set
            {
                SetValue("ORDER_FORM", value);
            }
        }

        [Field("EXTENDED_AMOUNT")]
        public decimal EXTENDED_AMOUNT
        {
            get
            {
                return (System.Decimal)GetValue("EXTENDED_AMOUNT");
            }
            set
            {
                SetValue("EXTENDED_AMOUNT", value);
            }
        }
        [Field("DISC_RATE")]
        public decimal DISC_RATE
        {
            get
            {
                return (System.Decimal)GetValue("DISC_RATE");
            }
            set
            {
                SetValue("DISC_RATE", value);
            }
        }
        [Field("DISC_AMOUNT")]
        public decimal DISC_AMOUNT
        {
            get
            {
                return (System.Decimal)GetValue("DISC_AMOUNT");
            }
            set
            {
                SetValue("DISC_AMOUNT", value);
            }
        }

        [Field("TRUCK_CODE")]
        public string TRUCK_CODE
        {
            get
            {
                return (System.String)GetValue("TRUCK_CODE");
            }
            set
            {
                SetValue("TRUCK_CODE", value);
            }
        }

        [Field("ADDITIONAL_INFO")]
        public string ADDITIONAL_INFO
        {
            get
            {
                return GetValue("ADDITIONAL_INFO") as string;
            }
            set
            {
                SetValue("ADDITIONAL_INFO", value);
            }
        }

		public static string GetStatusDescription(int statusCode)
        {
            EOderStatus status = (EOderStatus)Enum.Parse(typeof(EOderStatus), statusCode.ToString());
            return status.ToString();
        }

        public static string GetOrderType(int type)
        {
            switch (type)
            {
                case 0:
                    return "补损订单";
                case 1:
                    return "赠品订单";
                case 2:
                    return "正常订单";
                case 3:
                    return "换货订单";
                case 4:
                    return "退货订单";
                
                default:
                    return "未知";
            }
        }
    }

	//订单状态，用中文以绑定到DropdownList
    public enum EOderStatus
    {
        已确认 = 2,
        未确认 = 0,
        部分确认 = 20,
        已取消 = 1,
        部分取消 = 10,
        已制作 = 3,
        部分已制作 = 30,
        已完成 = 4,
        部份已完成 = 40,
        已提货 = 5,
        部分已提货 = 50
    }

    public enum EOrderType
    {
        补损订单=0,
        赠品订单=1,
        Nomal=2,
        换货订单=3,
        退货订单=4
    }

}
